<?php
/*
 * stone pei added 
 * backend field validation rule
 */
function webform_done_view($content) {
  //$contact_details = '';
  

  //-------------------defined submission variable---------------------------
  $employee_last_name = $content['employee_last_name'];
  $employee_first_name = $content['employee_first_name'];
  $email_contact_others = $content['email_contact_others'];
  
  
  if(isset($content['sending_work_location_site']) && trim($content['sending_work_location_site']) == '' ){
    if(isset($content['sending_work_city']) && $content['sending_work_city'] == LOCATION_CITY_OTHERS ){
      $sending_work_location_site = $content['please_specify_sending'];
    }else{
      $sending_work_location_site = $content['sending_work_city'];
    }
  }else{
    $sending_work_location_site = $content['sending_work_location_site'];
  }
  if(isset($content['receiving_work_location_site']) && trim($content['receiving_work_location_site']) == '' ){
    if(isset($content['receiving_work_city']) && $content['receiving_work_city'] == LOCATION_CITY_OTHERS ){
      $receiving_work_location_site = $content['please_specify_receiving'];
    }else{
      $receiving_work_location_site = $content['receiving_work_city'];
    }
  }else{
    $receiving_work_location_site = $content['receiving_work_location_site'];
  }
  $receiving_cost_centre = $content['receiving_cost_centre'];
  //---------------------- end ------------------------------
  

  
  global $language;
  $lang_wf = (isset($language->language)) ? $language->language : WEBFORM_DEFAULT_LANGUAGE;
  if ($lang_wf == WEBFORM_DEFAULT_LANGUAGE) {
    $msg = variable_get('BB_ST_INITIATION_RETURN_MSG');
  } else if ($lang_wf == WEBFORM_LANGUAGE_FR) {
    $msg = variable_get('BB_ST_INITIATION_RETURN_MSG_FR');
  } else if ($lang_wf == WEBFORM_LANGUAGE_DE) {
    $msg = variable_get('BB_ST_INITIATION_RETURN_MSG_DE');
  } else if ($lang_wf == WEBFORM_LANGUAGE_JA) {
    $msg = variable_get('BB_ST_INITIATION_RETURN_MSG_JA');
  } else if ($lang_wf == WEBFORM_LANGUAGE_TR) {
    $msg = variable_get('BB_ST_INITIATION_RETURN_MSG_TR');
  } else if ($lang_wf == WEBFORM_LANGUAGE_MX) {
    $msg = variable_get('BB_ST_INITIATION_RETURN_MSG_MX');
  }
  
  $msg = str_replace("<employee_last_name>", $employee_last_name, $msg);
  $msg = str_replace("<employee_first_name>", $employee_first_name, $msg);
  $msg = str_replace("<sending_work_location_site>", $sending_work_location_site, $msg);
  $msg = str_replace("<receiving_work_location_site>", $receiving_work_location_site, $msg);
  $msg = str_replace("<receiving_cost_centre>", $receiving_cost_centre, $msg);
  $msg = str_replace("<contact_information>", $email_contact_others, $msg);
  
  return $msg ;
}



